package com.tubi.MySemaphore;

import java.util.concurrent.Semaphore;

public class Myrunnable  implements   Runnable{
   private  Semaphore  Semaphore = new Semaphore(2);
    @Override
    public void run() {

        try {
            Semaphore.acquire();

            System.out.println("开始形式");
            Thread.sleep(2000);
            System.out.println("归还");
            Semaphore.release();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }
}
